package Text2;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/*
 *@Student 张策
 */
public class Main {
    public static void main(String[] args) {
        List list1 = new ArrayList();
        list1.add(new Dog("dog1",3));
        list1.add(new Dog("dog2",3));
        for (Object d :list1) {
            System.out.println(d);
        }
        Iterator iterator = list1.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
